﻿Namespace Sigortali.Yazismalar

    Public Class IsverenDaireYazismalari

        Shared Function VergiDairesiSiraNo(Token As Token, ByVal subekod As String) As String
            Return Token.OpenSQL("select isnull(max(kayitsirano),0)+1 from VergiDFaaliyetDurum where subekod=" & subekod)(0)
        End Function

        Shared Function VergiDYazismaOku(Token As Token, isyerino As String, isverensno As String) As Recordset
            Return Token.OpenSQL("select * from VergiDFaaliyetDurum where isyerino = @isyerino and isverensno=@isverensno order by Tarih desc", isyerino, isverensno)
        End Function

        Shared Sub VergiDYazismaKaydet(Token As Token, Stru As IsyeriFaaliyetVergiDairesi.VergiDairesiYazisiStruct)
            Dim Rs As Recordset = Token.OpenSQL("select * from VergiDFaaliyetDurum where 1 = 0")
            Rs.AddNew()
            With Stru
                Rs.SetValues("isyerino,isyeriAdi,isverenKimlik,isverensno,İsverenAdi,isverensoyadi", .isyeriNo, .FirmAd, .İsverenkimlik, .İsverenSno, .İsverenAdi, .İsverenSoyadi)
                Rs.SetValues("Tarih,kayitsirano,kaykul,subekod", .VerilisTarihi, .SeriNo, User.Kaykul, User.Department.ID)
            End With

            Rs.Save()

            '  [isyerino]
            ',[isyeriAdi]
            ',[isverenKimlik]
            ',[isverensno]
            ',[İsverenAdi]
            ',[isverensoyadi]
            ',[Tarih]
            ',[kayitsirano]
            ',[kaykul]
            ',[subekod]
            ',[rowid]

        End Sub
    End Class


End Namespace
